// components/musiclist/musiclist.js
const app = getApp()
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    musiclist: Array,
  },

  /**
   * 组件的初始数据
   */
  data: {
    playingId: -1,
  },

  pageLifetimes: {
    show() {
      console.log(11111111111111111111111)
      this.setData({
        playingId: parseInt(app.getPlayMusicId())
      })
    }
  },

  /**
   * 组件的方法列表
   */
  methods: {
    onSelect: function(event) {
      console.log(event.currentTarget.dataset.musicid)
      const ds = event.currentTarget.dataset
      const musicid = ds.musicid
      this.setData({
        playingId: musicid,
      })
      wx.navigateTo({
        url: `../../pages/player/player?musicId=${musicid}&index=${ds.index}`,
      })
    },
    // 播放mv
    playMv: function(e) {
      var mvId = e.currentTarget.dataset.id;
      console.log(mvId)
      wx.navigateTo({
        url: '../mv/mv?id=' + mvId + "&type=" + 0
      }).then((res) => {
        console.log(res)
      })
    },
  }
})